package com.caird.pmp.iot.handler.impl;


import com.caird.pmp.iot.handler.HandlerBase;
import com.caird.pmp.iot.message.IMessage;
import com.caird.pmp.iot.message.impl.DeviceMessage0002;
import com.caird.pmp.iot.message.impl.ServerMessage8001;
import com.caird.pmp.iot.server.BbChannelManager;
import io.netty.channel.Channel;
import org.springframework.stereotype.Controller;


@Controller
public class Handler0002 extends HandlerBase {

    //心跳
    @Override
    public boolean handle(Channel channel, IMessage message) {

        DeviceMessage0002 dm = (DeviceMessage0002)message;

        ServerMessage8001 sm = ServerMessage8001.success(dm, BbChannelManager.getFlowNo(channel));

        writeAndFlush(channel, sm.encode());

        return true;
    }
}
